<?php
/**
* @author: Pham Van Diep
* @date: 26/2/2014
*/

/**
* Not login
* Not permission
*
* Note: only root, nationalistrator, leader with permission national module
*/
if( !isset($AppUI) || 
	!isset($_SESSION['personal'])||
	(isset($_SESSION['personal']) && ($_SESSION['personal']&1<<0) == 0) ||
    !isset($_GET['personalid'])
) {
	redirect(HOST_BACKEND);
}
/*$intClubid  = intval($_GET['clubid']);
$intTotal   = 0;
$intPage    = $this->input->get('page', 1);
$intCancel	   = (int)$this->input->get('pcancel', 0);
$dStart     = CI_Function::convertStrToDate($this->input->get('startdate', null));
$dEnd       = CI_Function::convertStrToDate($this->input->get('enddate', null));
$intStatus  = $this->input->get('status',-1);
$intOption  = $this->input->get('option',0);
$strKeyword = $this->input->get('keyword',null);
$intLimit   = PAGING_NUMBER;
$intOffset  = ($intPage-1)*$intLimit;

if($dStart != '' || $dEnd != ''||$intStatus!=-1) {	
	$_SESSION['NATIONAL_CANCEL'] 	= 1;	
	$_SESSION['NATIONAL_SEARCH']	= $this->input->get();
}elseif($intOption!=''||$intStatus!=-1){ //kiem tra OptionSearch
	$_SESSION['NATIONAL_CANCEL'] 	= 1;	
	$_SESSION['NATIONAL_SEARCH']	= $this->input->get();
}
elseif($strKeyword!=''||$intStatus!=-1){ //kiem tra Keyword
	$_SESSION['NATIONAL_CANCEL'] 	= 1;	
	$_SESSION['NATIONAL_SEARCH']	= $this->input->get();
}
else {	
	if(isset($_SESSION['NATIONAL_SEARCH'])) unset($_SESSION['NATIONAL_SEARCH']);
	if(isset($_SESSION['NATIONAL_CANCEL'])) unset($_SESSION['NATIONAL_CANCEL']);
    $dStart = '';
    $dEnd = '';
	$intOption = 0;
	$strKeyword = '';
	$intStatus = -1;
}
if($intCancel) {
	if(isset($_SESSION['NATIONAL_SEARCH'])) unset($_SESSION['NATIONAL_SEARCH']);
	if(isset($_SESSION['NATIONAL_CANCEL'])) unset($_SESSION['NATIONAL_CANCEL']);
    $dStart = '';
    $dEnd = '';
	$intOption = 0;
	$strKeyword = '';
	$intStatus = -1;
}

$arrResult	= $this->national->getAll($AppUI->id,$intStatus,$intClubid,$intOption,$strKeyword,$dStart,$dEnd,$intOffset,$intLimit,$intTotal);
$this->smarty->assign('arrResult',  $arrResult);
$this->smarty->assign('intTotal',   $intTotal);
$this->smarty->assign('intOffset',  $intOffset);
$this->smarty->assign('intLimit',   $intLimit);
$this->smarty->assign('intClubid',  $intClubid);
//$this->smarty->assign('intReferId',    $intReferId);*/
$intPersonalId = intval($_GET['personalid']);
$this->load->library('common');
$arrNational = $this->common->getCountry();
$this->smarty->assign('arrNational', $arrNational);
//$this->smarty->assign('intTotal',   100);
//$this->smarty->assign('intOffset',  10);
//$this->smarty->assign('intLimit',   10);

$this->smarty->assign('personalid',$intPersonalId);
$this->smarty->display('national/index.tpl');